package yartiss.engine.simulation.scheduling.policies;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import yartiss.engine.simulation.IEnergyProfile;
import yartiss.engine.simulation.ISchedulingPolicy;
import yartiss.engine.simulation.Processor;
import yartiss.engine.simulation.events.EventGenerator;
import yartiss.engine.simulation.partition.IPartitionManager;
import yartiss.engine.simulation.system.ITask;
import yartiss.engine.simulation.system.ITaskSet;

public abstract class AbstractMonoProcessorSchedulingPolicy implements ISchedulingPolicy{

	protected Map<String, Long> metrics = new HashMap<String, Long>();
	
	@Override
	public void setParameters(List<Integer> parameters) {
	}
	
	@Override
	public List<Integer> getParameters() {
		return null;
	}
	
	@Override
	public Processor[] chooseNextTasks(Processor[] processors,	ITaskSet taskSet, IEnergyProfile energyProfile, long date,	EventGenerator evGen) {
		getMetrics().clear();
		processors[0].setNextTask(chooseNextTask(taskSet,energyProfile,date, evGen));
		return processors;
	}
	
	public abstract ITask chooseNextTask(ITaskSet taskSet, IEnergyProfile energyProfile, long date,	EventGenerator evGen);

	@Override
	public Map<String, Long> getMetrics() {
		return new HashMap<String, Long>(metrics);
	}
	
	@Override
	public IPartitionManager getPartitionManager() {
		return null;
	}
}
